package com.bankLogisticsSys.util;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.bankLogisticsSys.model.Networkinfo;
import com.bankLogisticsSys.service.Cron4jService;

public class NoTrackRemind implements Runnable{
	private static final Logger logger = LoggerFactory
			.getLogger(NoTrackRemind.class);
	
	@Override
	public void run() {
		Cron4jService cservice = new Cron4jService();
		List<Integer> networkidList = cservice.getBankNetworkList();
		List<Networkinfo> niList = cservice.getBankNetworkListW();
		//依次提醒1：内联 2：零贷 3：会计 4：市公积金 5：省公积金
		networkidList = cservice.getNoTrackBank(networkidList);
		cservice.sendNoTrackMsg(networkidList);
		logger.info("定时任务，提醒银行员工没有派单，并发出记录");
	}
	
	public Map<Integer,List<Integer>> getBusBankMap(List<Networkinfo> niList){
		Map<Integer,List<Integer>> busBankMap = new HashMap<Integer, List<Integer>>();
		for(Networkinfo x:niList){
			String bussinessSet = x.getBusinessSet();
			String[] busArray=bussinessSet.split(bussinessSet, '/') ;
			for(String y:busArray){
				if(busBankMap.containsKey(Integer.valueOf(y))){
					List<Integer> tmp1 = busBankMap.get(Integer.valueOf(y));
					tmp1.add(x.getId());
					busBankMap.put(Integer.valueOf(y), tmp1);
				}else{
					List<Integer> tmp2 = new ArrayList<Integer>();
					tmp2.add(x.getId());
					busBankMap.put(Integer.valueOf(y), tmp2);
				}
			}
		}
		return busBankMap;
	}
}